import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const state={
    bgMusic_isPlay:true,
    curPage:'home',
    activeDrink:{},
    drinkList:{
        drink1:{
            name:'drink1',
            titleSrc:'static/img/drink1/drink1_text.png',
            imgSrc:'static/img/drink1/drink1.png',
            successSrc:'static/img/drink1/drink1_success.png',
            emptyContain:'static/img/drink1/drink1_step0.png',
            step:[
                    {
                        title:'草莓软心薄荷糖',
                        dosing:'static/img/drink1/drink1_1.png',
                        glass:'static/img/drink1/drink1_step1.png',
                        gif:''
                    },
                    {
                        title:'桂格麦果脆',
                        dosing:'static/img/drink1/drink1_2.png',
                        glass:'static/img/drink1/drink1_step2.png',
                        gif:''
                    },
                    {
                        title:'伊利牛奶',
                        dosing:'static/img/drink1/drink1_3.png',
                        glass:'static/img/drink1/drink1_step3.png',
                        gif:''
                    },
                    {
                        title:'立顿红茶',
                        dosing:'static/img/drink1/drink1_4.png',
                        glass:'static/img/drink1/drink1_step4.png',
                        gif:''
                    }
            ],
            complete:{
                img:'static/img/drink1/drink1_ok.png'
            },
            shake:{
                shade1:'static/img/drink1/drink1_shake_bg.jpg',
                shade2:'static/img/drink1/drink1_shake_bg.jpg',
                shade3:'static/img/drink1/drink1_shake_bg.jpg'
            },
            success:{
                img:'static/img/drink1/drink1_success.png'
            },
            failed:{
                img:'static/img/drink1/drink1_failed.png'
            }
        },
        drink2:{
            name:'drink2',
            titleSrc:'static/img/drink2/drink2_text.png',
            imgSrc:'static/img/drink2/drink2.png',
            successSrc:'static/img/drink2/drink2.png',
            emptyContain:'static/img/drink2/drink2_step0.png',
            step:[
                    {
                        title:'草莓软心薄荷糖',
                        dosing:'static/img/drink2/drink2_1.png',
                        glass:'static/img/drink2/drink2_step1.png',
                        gif:''
                    },
                    {
                        title:'桂格麦果脆',
                        dosing:'static/img/drink2/drink2_2.png',
                        glass:'static/img/drink2/drink2_step2.png',
                        gif:''
                    },
                    {
                        title:'伊利牛奶',
                        dosing:'static/img/drink2/drink2_3.png',
                        glass:'static/img/drink2/drink2_step3.png',
                        gif:''
                    },
                    {
                        title:'立顿红茶',
                        dosing:'static/img/drink2/drink2_4.png',
                        glass:'static/img/drink2/drink2_step4.png',
                        gif:''
                    }
            ],
            complete:{
                img:'static/img/drink2/drink2_ok.png'
            },
            shake:{
                bg:'static/img/drink2/drink2_shake_bg.jpg'
            },
            success:{
                img:'static/img/drink2/drink2.png'
            },
            failed:{
                img:'static/img/drink2/drink2_failed.png'
            }
        },
        drink3:{
            name:'drink3',
            titleSrc:'static/img/drink3/drink3_text.png',
            imgSrc:'static/img/drink3/drink3.png',
            successSrc:'static/img/drink3/drink3.png',
            emptyContain:'static/img/drink3/drink3_step0.png',
            step:[
                    {
                        title:'草莓软心薄荷糖',
                        dosing:'static/img/drink3/drink3_1.png',
                        glass:'static/img/drink3/drink3_step1.png',
                        gif:''
                    },
                    {
                        title:'桂格麦果脆',
                        dosing:'static/img/drink3/drink3_2.png',
                        glass:'static/img/drink3/drink3_step2.png',
                        gif:''
                    },
                    {
                        title:'伊利牛奶',
                        dosing:'static/img/drink3/drink3_3.png',
                        glass:'static/img/drink3/drink3_step3.png',
                        gif:''
                    },
                    {
                        title:'立顿红茶',
                        dosing:'static/img/drink3/drink3_4.png',
                        glass:'static/img/drink3/drink3_step4.png',
                        gif:''
                    }
            ],
            complete:{
                img:'static/img/drink3/drink3_ok.png'
            },
            shake:{
                bg:'static/img/drink3/drink3_shake_bg.jpg'
            },
            success:{
                img:'static/img/drink3/drink3.png'
            },
            failed:{
                img:'static/img/drink3/drink3_failed.png'
            }
        },
        drink4:{
            name:'drink4',
            titleSrc:'static/img/drink4/drink4_text.png',
            imgSrc:'static/img/drink4/drink4.png',
            successSrc:'static/img/drink4/drink4.png',
            emptyContain:'static/img/drink4/drink4_step0.png',
            step:[
                    {
                        title:'草莓软心薄荷糖',
                        dosing:'static/img/drink4/drink4_1.png',
                        glass:'static/img/drink4/drink4_step1.png',
                        gif:''
                    },
                    {
                        title:'桂格麦果脆',
                        dosing:'static/img/drink4/drink4_2.png',
                        glass:'static/img/drink4/drink4_step2.png',
                        gif:''
                    },
                    {
                        title:'伊利牛奶',
                        dosing:'static/img/drink4/drink4_3.png',
                        glass:'static/img/drink4/drink4_step3.png',
                        gif:''
                    },
                    {
                        title:'立顿红茶',
                        dosing:'static/img/drink4/drink4_4.png',
                        glass:'static/img/drink4/drink4_step4.png',
                        gif:''
                    }
            ],
            complete:{
                img:'static/img/drink4/drink4_ok.png'
            },
            shake:{
                bg:'static/img/drink4/drink4_shake_bg.jpg'
            },
            success:{
                img:'static/img/drink4/drink4.png'
            },
            failed:{
                img:'static/img/drink4/drink4_failed.png'
            }
        },

    }
}

const getters={
    curPage(state){
        return state.curPage
    },
    activeDrink(state){
        return state.activeDrink
    },
    drinkList(){
        return state.drinkList
    },
    bgMusic_isPlay(state){
        return state.bgMusic_isPlay
    }
}

const mutations={
//   [CHANGE_SESSION](state,{session}){
//     state.active_session=session
//   },
    _switchPage(state,pageName){
        state.curPage=pageName
    },
    _switchDrink(state,drinkName){
        state.activeDrink=state.drinkList[drinkName]
    },
    _bgMusicPlay(state,isPlay){
        state.bgMusic_isPlay=isPlay
    }
}

const actions={

    switchPage({commit},pageName){
        commit('_switchPage',pageName)
    },
    switchDrink({commit},drinkName){
        commit('_switchDrink',drinkName)
    },
    bgMusicPlayToggle({commit},isPlay){
        commit('_bgMusicPlay',isPlay)
    }

}

export default new Vuex.Store({
    state,
    getters,
    mutations,
    actions
})